import request from '@/utils/request'
import storage from '@/utils/storage'

const dataInfo = JSON.parse(storage.get('userInfo'))

// 计划列表
export function fetchPlanList(params) {
    return request({
        url: '/operation/opTask/queryList',
        method: 'get',
        params: {
        'directoryId': params.directoryId,
        'name': params.name     ,
        'startDate': params.startDate,
        'endDate': params.endDate,
        'status': params.status,
        'pageIndex': params.pageIndex,
        'pageSize': params.pageSize
        },
        port: { ENV_PORT: 8004 },
        ajaxType2: 'reqGet'
    })
}

//计划详情
export function planDetail(id) {
    return request({
        url: '/operation/opTask/detail',
        method: 'get',
        params: {'id': id},
        port: { ENV_PORT: 8004 },
        ajaxType2: 'reqGet'
    })
}

//添加计划
export function planAdd(data) {
    return request({
      url: '/operation/opTask/add',
      method: 'post',
      data,
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqPost'
    })
  }

  // 删除计划
export function planDelete(id) {
    return request({
        url: '/operation/opTask/delete',
        method: 'delete',
        params:{id},
        port: { ENV_PORT: 8004 },
        ajaxType2: 'reqDelete'
    })
}

//审核计划
export function planApprove(data) {
    return request({
      url: '/operation/opTask/approve',
      method: 'put',
      data,
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqPut'
  
    })
  }

//修改广告
export function planUpdate(data) {
    return request({
      url: '/operation/opTask/update',
      method: 'put',
      data,
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqPut'
  
    })
  }

//追加上刊
export function planAddDeploy(data) {
    return request({
      url: '/operation/opTask/addDeploy',
      method: 'post',
      data,
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqPost'
  
    })
  }

//覆盖上刊
export function planCoverDeploy(data) {
    return request({
      url: '/operation/opTask/coverDeploy',
      method: 'post',
      data,
      port: { ENV_PORT: 8004 },
      ajaxType2: 'reqPost'
  
    })
  }

//计划下刊
export function planUndeploy(id) {
    return request({
        url: '/operation/opTask/unDeploy',
        method: 'get',
        params: {'id': id},
        port: { ENV_PORT: 8004 },
        ajaxType2: 'reqGet'
    })
}